package testcase.setting;

import basic.BasicCase;
import org.junit.Assert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;

/**
 * Created by 13714526025 on 2018/9/17.
 * 提交意见反馈
 */
public class FeedBack extends BasicCase{
    @Test
    public void testName() throws InterruptedException {
        Thread.sleep(3000);
        finder.waitforWebElement("com.oppo.ohome:id/iv_setting");
        //主界面点击“设置”按钮
        driver.findElement(By.id("com.oppo.ohome:id/iv_setting")).click();
        //点击意见反馈进入
        driver.findElement(By.id("com.oppo.ohome:id/feedback_item")).click();
        Thread.sleep(3000);
        driver.findElementByName("我要反馈").click();
        //判断跳转后的页面标题是否正确
        Assert.assertTrue(driver.findElement(By.name("我要反馈")).isDisplayed());
        driver.findElementByName("请在此快速选择您遇到的问题").click();
        driver.findElementByName("其它问题/建议").click();
        //定位到问题描述输入框
        WebElement editDescription=driver.findElementsByClassName("android.widget.EditText").get(0);
        editDescription.click();
        editDescription.sendKeys("123Asd@#$%^&* ☺");
        WebElement editPhone=driver.findElementsByClassName("android.widget.EditText").get(1);
        editPhone.click();
        editPhone.sendKeys("25639876521");
        driver.findElementByName("点击提交").click();
        Assert.assertTrue(driver.findElement(By.name("感谢您的反馈，我们会尽快作出回复！")).isDisplayed());//根据文字判断是否提交成功
    }
}
